// v1.0.1

//Town script for town 16: Empire HQ

begintownscript;

variables;

int choice,day4,day5;

body;

beginstate INIT_STATE;

	set_crime_tolerance(3);
	
	
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(6,"Hmmm");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(6,"And what if I...");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(9,"Yawn");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(7,"Mushrooms");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(7,"I need mushrooms");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(10,"Sigh");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(58,"Slurp");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(59,"Slurp");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(66,"Dei Magni");
	if (get_ran(1,0,100) < 6)
		text_bubble_on_char(66,"Adiuvate me");
		
	set_flag(16,5,0);
	
break;

beginstate EXIT_STATE;
break;

beginstate START_STATE;

	day4 = get_flag(250,3);
	
	if (day4 == 1) {
			erase_char(71);
			}
	
	if (day4 == 2) {
			erase_char(71);
			erase_char(64);
			}
	
	if (day4 == 3) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			}
	
	if (day4 == 4) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			}
			
	if (day4 == 5) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			}
	
	if (day4 == 6) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			}
	
	if (day4 == 7) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			}
	
	if (day4 == 8) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			erase_char(70);
			}
	
	if (day4 == 9) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			erase_char(70);
			erase_char(55);
			}
	
	if (day4 == 10) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			erase_char(70);
			erase_char(55);
			erase_char(67);
			}
	
	if (day4 == 11) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			erase_char(70);
			erase_char(55);
			erase_char(67);
			erase_char(75);
			}
	
	if (day4 == 12) {
			erase_char(71);
			erase_char(64);
			erase_char(69);
			erase_char(54);
			erase_char(74);
			erase_char(68);
			erase_char(73);
			erase_char(70);
			erase_char(55);
			erase_char(67);
			erase_char(75);
			erase_char(72);
			}

break;

beginstate 10;
	move_to_new_town(17,5,8);
break;

beginstate 11;
if (get_flag(16,1) == 1)
		end();
	message_dialog("There is a small hill in this corner of the fort. A young priest is standing on it. He seems to be cutting up sheep. This is the _religious corner_ of the fort, you presume, with a small altar to banish the unwanted souls.","");
	set_flag(16,1,1);
break;

beginstate 12;
if (get_flag(16,2) == 1)
		end();
	message_dialog("Here are the Empire headquarters' archives. A wizard is sitting in the chair to your right, waiting to help somebody out. While waiting, he reads papers and letters.","");
	set_flag(16,2,1);
break;

beginstate 13;
if (get_flag(16,3) == 1)
		end();
	message_dialog("The dining hall of the lower fort is roomy and quite nice. Two fires burn in the corner, and two bookshelves provide books to read.","");
	set_flag(16,3,1);
break;

beginstate 14;
if (get_flag(16,4) == 1)
		end();
	message_dialog("The smell in the kitchen is great. You could stand here for some time, only to just smell all those wonderful scents, but you have to move on.","");
	set_flag(16,4,1);
break;

beginstate 15;
if (get_flag(16,5) == 1)
		end();
	message_dialog("You walk to the archives, but the wizard at the door calls you back. _Sorry, but you can't go in there! You must have my permission. If you get somebody to sign a note that says that you have permission, show me the note first._","He starts reading his letters and bills again, when he remembers something. _Wait, you can also ask me to get something for you, if it is necessary, but you have to have a good reason.");
	block_entry(1);
break;

beginstate 16;
reset_dialog();
add_dialog_str(0,"These are the scrolls on which everything about Thralni is written. It could be very interesting and helpful to look through them. Do you?",0);
add_dialog_choice(0,"Search the bookshelf");
add_dialog_choice(1,"Leave them");
choice = run_dialog(1);

	if (choice == 1) {
			reset_dialog();
			add_dialog_str(0,"You search this bookshelf, until you find a scroll which seems interesting. You eventually find a scroll telling you about the very first time the Empire came here.",0);
			add_dialog_str(1,"_The mountainous terrain of the Thraldom is difficult for our soldiers, as they can't navigate here properly. That's Thralni's big advantage, as his army isn't very big. We will crush him anyhow._",0);
			add_dialog_str(2,"_However, we have located his castle, so if we can attack and conquer it soon, Thralni will be lost._",0);
			add_dialog_str(3,"The scroll continues explaining what happened to the Empire army.",0);
			add_dialog_choice(0,"Read on");
			choice = run_dialog(1);
			
			reset_dialog();
			add_dialog_str(0,"_The war has started out bad for us, but if we keep exploring the Thraldom, everything will be fine. We have taken in Thralni's castle. It is merely a ruin now. Further more, we have sealed the castle with a spell._",0);
			add_dialog_str(1,"_Now that we know for sure Thralni can't enter his castle a second time, its time to eradicate the Thralnian army. To do this, we will first attack Filberton._",0);
			add_dialog_str(2,"_Filberton houses one of the most successful magery schools of our time, and therefor its an important, but dangerous place, which we will have to wipe out as soon as possible.",0);
			add_dialog_str(3,"The scroll ends with this last bit: _Success! The Empire has conquered the Thraldom. A big fort, the headquarters of the Thraldom Empire forces, will be built to ensure safety. The Thraldom is no more. Only Riverrod._",0);
			add_dialog_choice(0,"Put the scroll back");
			choice = run_dialog(1);
			end();
			}
		message_dialog("You put the scrolls back and leave.","");
break;

beginstate 17;
reset_dialog();
add_dialog_str(0,"These are the scrolls on which everything about Thralni is written. It could be very interesting and helpful to look through them. Do you?",0);
add_dialog_choice(0,"Search the bookshelf");
add_dialog_choice(1,"Leave them");
choice = run_dialog(1);

	if (choice == 1) {
			reset_dialog();
			add_dialog_str(0,"The scroll you found here tells you about the developments of the Thraldom after it was conquered by the Empire.",0);
			add_dialog_str(1,"_We have started building the Riverrod Empire headquarters. It will surely be a heavily defended fort, but that is necessary in these times. He who wants to rule, will have to show his power._",0);
			add_dialog_str(2,"_In the meantime all cities have felt what it is to be the ally of the enemy. All cities are smoking piles of rubble (You start sweating at only the thought). They got what they deserved._",0);
			add_dialog_str(3,"_The people living here are already trying to pick up normal life, though it doesn't really work out. Cities are already being rebuilt. The Empire doesn't help them, though, as its their own stupid fault._",0);
			add_dialog_choice(0,"Read on");
			choice = run_dialog(1);
			
			reset_dialog();
			add_dialog_str(0,"It takes a while before you can comprehend what you just read. Its terribly egoistic what the Empire did. Is this really the Empire you serve?",0);
			add_dialog_str(1,"The scroll says more:",0);
			add_dialog_str(2,"_Thralni went into hiding. Every time we think we have got him, he escapes us. Its terribly frustrating, but who would we be if not the Empire? We will find him, and when we do, it will be all finished for him._",0);
			add_dialog_str(3,"That's the end of this scroll. What you just read doesn't please you at all.",0);
			add_dialog_choice(0,"Put the scroll back");
			choice = run_dialog(1);
			}
		message_dialog("You put the scrolls back and leave.","");
break;

beginstate 18;
reset_dialog();
add_dialog_str(0,"These are the scrolls on which everything about Thralni is written. It could be very interesting and helpful to look through them. Do you?",0);
add_dialog_choice(0,"Search the bookshelf");
add_dialog_choice(1,"Leave them");
choice = run_dialog(1);

	if (choice == 1) {
			reset_dialog();
			add_dialog_str(0,"The scroll in this bookshelf is made of delicate paper. A red seal has been put on it. Its a letter. A letter from Emperor Thralni III to Emperor Hawthorn",0);
			add_dialog_choice(0,"Read it");
			choice = run_dialog(1);
			
			reset_dialog();
			add_dialog_str(0,"_The Thraldom, Leafloss 756_",0);
			add_dialog_str(1,"_The Thraldom wishes to meet Emperor Hawthorn for private conversations. Emperor Thralni wishes to negotiate about peace, land ownage and possible alliance._",0);
			add_dialog_str(2,"_Send a letter back with the messenger bearing this scroll as quickly as possible.",0);
			add_dialog_str(3,"_was signed, Thralni III, Emperor of the Thraldom_",0);
			add_dialog_choice(0,"Put the scroll back");
			choice = run_dialog(1);
			
			reset_dialog();
			add_dialog_str(0,"You put the scroll back and think. It seems as though Thralni III actually wanted to meet with Emperor Hawthorn to negotiate about peace.",0);
			add_dialog_str(1,"If you remember the Avernum history correctly, Thralni III was the Thralni who got killed in Avernum. How interesting.",0);
			add_dialog_choice(0,"Okay");
			choice = run_dialog(1);
			}
		message_dialog("You put the scrolls back and leave.","");
break;